{extend name="default/base/base_home" /}
{block name="mall_main"}

<style type="text/css">
#box { background: #FFF; width: 238px; height: 410px; margin: -390px 0 0 0; display: block; border: solid 4px #D93600; position: absolute; z-index: 999; opacity: .5 }
#infscr-loading { display: none; }
</style>
<script src="{$Think.HOME_SITE_ROOT}/js/search_goods.js"></script>

<div class="dsh-container wrapper">
  <div class="dsp-category">
    <ul>
      <input type="hidden" id="storeclass_id" value="{$Request.param.gc_id}"/>
      <li><a class="" href="{:url('Promotion/index')}">{$Think.lang.ds_all_goods_class}</a></li>
      {foreach name="goods_class" item="v" key="k" }
      <li><a class="{if condition="$Request.param.gc_id eq $v.gc_id"}selected{/if}" href="{:url('Promotion/index',['gc_id'=>$v.gc_id])}"}'>{$v.gc_name}</a></li>
      {/foreach}
    </ul>
  </div>
    {notempty name="goods_list"}
  <div id="promotionGoods">
      {foreach name="goods_list" item="goods_info"}
      <div class="item">
          <div class="scope">
              <dl class="goods">
                  <dt class="goods-thumb"> <a title="{$goods_info.goods_name}" target="_blank" href="{$goods_info.goods_url}"><img src="{$goods_info.image_url_240}" /></a> </dt>
                  <dd class="goods-name"><span><strong>{$goods_info.xianshi_title}</strong></span> <a target="_blank" href="{$goods_info.goods_url}">{$goods_info.goods_name}</a></dd>
              </dl>
              <div class="goods-price"><span class="sale">{$Think.lang.sale_price}<em>{:ds_price_format_forlist($goods_info['xianshigoods_price'])}</em>{$Think.lang.ds_yuan}</span><span class="depreciate"><i class="iconfont">&#xe689;</i>{$Think.lang.direct_fall}：¥{$goods_info.down_price}</span></div>
              {if (session('is_login') === '1')}
              <div class="goods-buy"><a href="javascript:void(0);" dstype="add_cart" data-param="{goods_id:{$goods_info.goods_id}}" class="btn">{$Think.lang.immediate_rush}</a> <span class="raty" data-score="{$goods_info.evaluation_good_star}" style="width: 100px;"></span> <span class="mt5"><a href="{:url('Store/index',['store_id'=>$goods_info.store_id])}">{$goods_info.store_name}</a></span> </div>
              {/if}
              <ul class="goodseval">
                  {notempty name="$goodsevallist[$goods_info['goods_id']]"}
                  {foreach name="$goodsevallist[$goods_info['goods_id']]" item="v" key="k" }
                  <li>
                      <div class="user-avatar"> <img src="{:get_member_avatar_for_id($v['geval_frommemberid'])}">  </div>
                      <div class="eval"><i class="iconfont">&#xe752;</i>{$v.geval_content}<i class="iconfont">&#xe751;</i></div>
                  </li>
                  {/foreach}
                  {/notempty}
              </ul>
          </div>
      </div>
      {/foreach}
  </div>
   {else /}
  <div class="no_results">{$Think.lang.index_no_record}</div>
  {/notempty}
</div>
<script src="{$Think.PLUGINS_SITE_ROOT}/jquery.masonry.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/jquery.infinitescroll.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery.raty/jquery.raty.min.js"></script>
<script>
var $container = $('#promotionGoods');
$container.masonry({
    columnWidth: 305,
    itemSelector: '.item'
});
$(function(){
    $container.infinitescroll({
        navSelector : '#page-more',
        nextSelector : '#page-more a',
        itemSelector : '.item',
        loading: {
            selector:'#page-nav',
            img: '{$Think.HOME_SITE_ROOT}/images/loading.gif',
            msgText:{$Think.lang.promotion_prompt_words1},
            maxPage : '{$total_page}',
            finishedMsg : {$Think.lang.promotion_prompt_words2},
        finished : function() {
        $('.raty').raty({
            path: "{$Think.PLUGINS_SITE_ROOT}/js/jquery.raty/img",
            readOnly: true,
            width: 100,
            score: function() {
                return $(this).attr('data-score');
            }
        });
    }
}
},function(newElements){
        var $newElems = $(newElements);
        $container.masonry('appended', $newElems, true);
    });

    $('.raty').raty({
        path: "{$Think.PLUGINS_SITE_ROOT}/js/jquery.raty/img",
        readOnly: true,
        width: 100,
        score: function() {
            return $(this).attr('data-score');
        }
    });
});
</script>

{/block}

